fix(tui): scope model candidates to active provider#3428
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Code Review
This pull request refactors the model picker and slash command completions to scope model choices strictly to the active provider, removing the automatic cross-provider switching behavior. The reviewer feedback recommends removing the unused _api_provider parameter from the newly introduced slash_completion_hints_with_model_candidates function and its callers to simplify the function signatures and reduce coupling.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| let model_candidates = model_completion_names_for_provider(api_provider) | ||
| .into_iter() | ||
| .map(str::to_string) | ||
| .collect::<Vec<_>>(); | ||
| slash_completion_hints_with_model_candidates( | ||
| input, | ||
| limit, | ||
| cached_skills, | ||
| locale, | ||
| workspace, | ||
| api_provider, | ||
| &model_candidates, | ||
| ) | ||
| } | ||
|
|
||
| pub(crate) fn slash_completion_hints_with_model_candidates( | ||
| input: &str, | ||
| limit: usize, | ||
| cached_skills: &[(String, String)], | ||
| locale: crate::localization::Locale, | ||
| workspace: Option<&std::path::Path>, | ||
| _api_provider: ApiProvider, | ||
| model_candidates: &[String], | ||
| ) -> Vec<SlashMenuEntry> { |
There was a problem hiding this comment.
The _api_provider parameter in slash_completion_hints_with_model_candidates is unused. We can remove it to simplify the function signature and reduce coupling.
let model_candidates = model_completion_names_for_provider(api_provider)
.into_iter()
.map(str::to_string)
.collect::<Vec<_>>();
slash_completion_hints_with_model_candidates(
input,
limit,
cached_skills,
locale,
workspace,
&model_candidates,
)
}
pub(crate) fn slash_completion_hints_with_model_candidates(
input: &str,
limit: usize,
cached_skills: &[(String, String)],
locale: crate::localization::Locale,
workspace: Option<&std::path::Path>,
model_candidates: &[String],
) -> Vec<SlashMenuEntry> {| slash_completion_hints_with_model_candidates( | ||
| &app.input, | ||
| limit, | ||
| &app.cached_skills, | ||
| app.ui_locale, | ||
| Some(&app.workspace), | ||
| app.api_provider, | ||
| &model_candidates, | ||
| ) |
| let candidates = slash_completion_hints_with_model_candidates( | ||
| &app.input, | ||
| 128, | ||
| &app.cached_skills, | ||
| app.ui_locale, | ||
| Some(&app.workspace), | ||
| app.api_provider, | ||
| &model_candidates, | ||
| ) |
There was a problem hiding this comment.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Make the /model command, model picker main section, and slash completions stay inside the active provider scope. Cross-provider saved/catalog rows no longer appear as bare model choices or silently switch providers; explicit route-switch UX remains deferred to the route resolver/search work. Tests: cargo test -p codewhale-tui --bin codewhale-tui --locked tui::model_picker; cargo test -p codewhale-tui --bin codewhale-tui --locked tui::widgets; cargo test -p codewhale-tui --bin codewhale-tui --locked visible_slash_model_completions_are_provider_scoped; cargo test -p codewhale-tui --bin codewhale-tui --locked commands::groups::core::core; cargo test -p codewhale-tui --bin codewhale-tui --locked model_inventory; cargo test -p codewhale-tui --bin codewhale-tui --locked route_resolver; python3 scripts/check-provider-registry.py; cargo fmt --all -- --check; git diff --check
Keep the slash completion convenience wrapper test-only after the production slash menu path moved to explicit provider-scoped candidates. This avoids dead-code and unused-import failures under release/clippy builds while preserving the existing widget unit tests.
Remove the unused api_provider parameter from the provider-scoped slash completion helper after the live app path started passing explicit model candidates. Verified with: - cargo fmt --all -- --check - git diff --check - python3 scripts/check-provider-registry.py - cargo test -p codewhale-tui --bin codewhale-tui --locked tui::model_picker - cargo test -p codewhale-tui --bin codewhale-tui --locked tui::widgets - cargo test -p codewhale-tui --bin codewhale-tui --locked visible_slash_model_completions_are_provider_scoped - cargo test -p codewhale-tui --bin codewhale-tui --locked commands::groups::core::core - cargo test -p codewhale-tui --bin codewhale-tui --locked model_inventory - cargo test -p codewhale-tui --bin codewhale-tui --locked route_resolver (0 matching tests) - cargo test -p codewhale-tui --bin codewhale-tui --locked slash_completion_hints_model_provider_uses_provider_specific_ids - cargo clippy -p codewhale-tui --bin codewhale-tui --locked -- -D warnings -A clippy::uninlined_format_args -A clippy::too_many_arguments -A clippy::unnecessary_map_or -A clippy::assertions_on_constants
08df5a7 to
51fb515
Compare
|
Claude finished @Hmbown's task in 3m 14s —— View job PR Review: fix(tui): scope model candidates to active provider
SummaryClean, focused implementation of #3383. The provider-scoped picker and slash-menu path are consistent, the removed Correctness
Provider/Model/Route Safety (EPIC #2608 invariant)Looks good. The three code paths that could previously infer a silent provider switch are all addressed:
No code in this diff infers a provider switch from a model string prefix or freeform text. ✓ Reuse / SimplificationGemini feedback already resolved. The
TestsGood regression coverage. A few observations:
Minor nit
Overall: ready to merge. The Gemini feedback was addressed before this review. The route-safety invariant is correctly enforced. No correctness bugs found. |
Document the include_current_model flag split between slash completions and the picker custom-model row. Verification: - cargo fmt --all -- --check - git diff --check - CARGO_TARGET_DIR=/Volumes/VIXinSSD/codewhale-target-v0865 cargo test -p codewhale-tui --bin codewhale-tui --locked tui::model_picker
|
Claude finished @Hmbown's task in 3m 14s —— View job
PR Review: fix(tui): scope model candidates to active provider (re-review after sync)This review covers the updated branch as of the four commits ( Correctness
Minor nit — hardcoded literal vs constant in assert!(names.contains(&"/model deepseek-ai/DeepSeek-V4-Pro"));The model picker test uses the constant instead ( assert!(names.contains(&format!("/model {}", crate::config::DEFAULT_TOGETHER_MODEL).as_str()));Low priority — won't break anything unless the constant value is renamed.
Provider/Model/Route Safety (EPIC #2608)All three leakage paths from the prior review remain cleanly closed:
Important: Reuse / Simplification
TestsGood coverage for the new behavior. Two remaining gaps noted for awareness (neither is a blocker):
Overall: ready to merge. Gemini feedback addressed ( |
Goal
Advance #3383 by making the main
/modelsurfaces provider-scoped by default. A bare model string should no longer look like permission to switch providers.Changes
/model <name>so saved models from other providers no longer silently emitSwitchProviderVerification
cargo test -p codewhale-tui --bin codewhale-tui --locked tui::model_pickercargo test -p codewhale-tui --bin codewhale-tui --locked tui::widgetscargo test -p codewhale-tui --bin codewhale-tui --locked visible_slash_model_completions_are_provider_scopedcargo test -p codewhale-tui --bin codewhale-tui --locked commands::groups::core::corecargo test -p codewhale-tui --bin codewhale-tui --locked model_inventorycargo test -p codewhale-tui --bin codewhale-tui --locked route_resolver(0 matching tests)python3 scripts/check-provider-registry.pycargo fmt --all -- --checkgit diff --checkRisks
slash_completion_hints(...)test helper still defaults to static provider rows; the live app path now passes the provider-scoped candidate projection fromApp.ReadyRouteCandidateor v0.8.65: Provider-owned live catalogs and secret-free model cache #3385 live catalog/cache work.Fixes #3383.